import React from 'react'
// ===================================================================== Temp
import SearchForm from '#cpt/temp/SearchForm'
import Table from '#cpt/temp/Table'
// ===================================================================== global declare
const { $fn, $Lazy } = window
// ===================================================================== Lazy
const Page 					= $Lazy.load(()=>import('#tp/page/page-container'))
const TableComponent 		= $Lazy.state(()=>import('./cpt/table-component'))
// ===================================================================== component
class Index extends React.Component{
	state = {
		data:[],
		pag: {},
		selectedKeys:[],
		// 搜索表单列表
		forms : [
			{ label: '标本条码',		name: 'spec_code' },
			{ label: '实验号',		name: 'exper_num' },
			{ label: '时间',			names: ['start_date','end_date'], type:'date-range' },
		]
	}
	
	model = {}
	
	componentDidMount(){
		if(window.isInit){
			this.fetch()
		}
	}
	
	// paging
	fetch = () => $fn.fetch.call(this,'kd-report-spec/1111', {isIndex:true})
	
	// 表单
	cols = [
		{ title: '标本条码',			dataIndex: 'spec_code', 		...$fn.table.spec_code },
		{ title: '实验号', 			dataIndex: 'exper_num', 		width:200 },
		{ title: '接收结果时间', 		dataIndex: 'created_at', 		...$fn.table.time },
	]
	render(){
		return (
			<>
				<Page title='检测结果赋值' >
					{/* 搜索 */}
					{ SearchForm.call(this) }
					{/* 表格 */},
					<div className='rel i10 ex rel fv'>
						{ Table.call(this,{isInit:window.isInit, onSelectOk:( key , rows ) => this.tableRef.fetch(rows[0]), isIndex:true }) }
					</div>
					{/* 表格 */}
					<TableComponent onRef={ ref => this.tableRef = ref }/>
				</Page>
			</>
		)
	}
}

export default Index